/** **
 * 由于vite内置的scss预处理器不支持:export语法
 * 详情见Issue: https://github.com/vitejs/vite/issues/1279
 *
 * 考虑到import时取到的是已进行scss变量替换的字符串，我们可以使用解析字符串的方式获取SCSS相关定义的变量值。
 */

import themeColors from 'app/styles/theme_export.less?inline'
const themeColorObj = {}
const START_PREFIX = ':export{'
const minThemeColorStr = themeColors.replace(/\n| |\}/ig, '')
const startIndex = minThemeColorStr.indexOf(START_PREFIX)
if (startIndex >= 0) {
  const colorStr = minThemeColorStr.substring(startIndex + START_PREFIX.length)
  const colorArr = colorStr.split(';')
  colorArr.forEach(item => {
    if (item && item.indexOf(':')) {
      const colorItem = item.split(':')
      themeColorObj[colorItem[0]] = colorItem[1]
    }
  })
}
console.log(themeColorObj);
export default themeColorObj
